<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>

<body layadmin-themealias="default">

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body" pad15="">
                        <div class="layui-form" wid100="" lay-filter="">
                            <input type="hidden" name="id" value="{$id}">

                            <div class="layui-form-item">
                                <label class="layui-form-label">标题</label>
                                <div class="layui-input-inline" style="width: 400px;">
                                    <input type="text" name="title" value="{$data.title}" class="layui-input"
                                        placeholder="标题" lay-verify="required">
                                </div>
                            </div>
                            <div class="layui-form-item" id="img1">
                                <label class="layui-form-label">直播封面</label>
                                <div class="layui-input-inline">
                                    <input name="thumb" lay-verify="required" id="LAY_iconImgSrc" placeholder="图片地址"
                                        value="{$data.thumb}" class="layui-input">
                                </div>
                                <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                    <button type="button" class="layui-btn layui-btn-primary" id="LAY_iconImgUpload">
                                        <i class="layui-icon">&#xe67c;</i>上传图片
                                    </button>
                                    <button class="layui-btn layui-btn-primary"
                                        layadmin-event="coverImgPreview">查看图片</button>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">修改直播状态: </label>

                                <div class="layui-inline">
                                    <select name="status" lay-verify="required">
                                        <option value="">请选择</option>
                                        <option value="0" {$data.status==0?'selected':''}>主播暂时离开</option>
                                        <option value="1" {$data.status==1?'selected':''}>直播中</option>
                                        <option value="2" {$data.status==2?'selected':''}>未开播</option>
                                    </select>
                                </div>

                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">水印位置</label>
                                <div class="layui-input-block">
                                    <input type="radio" value="l" name="watermark_position" title="左"
                                        {$data.watermark_position=='l' ?'checked':''} />
                                    <input type="radio" value="r" name="watermark_position" title="右"
                                        {$data.watermark_position=='r' ?'checked':''} />
                                    <input type="radio" value="n" name="watermark_position" title="无"
                                        {$data.watermark_position=='n' ?'checked':''} />
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">源地址播放</label>
                                <div class="layui-input-block">
                                    <input type="radio" value="1" {$data.play_from_source=='1' ? 'checked' :''}
                                        name="play_from_source" title="开启" />
                                    <input type="radio" value="0" {$data.play_from_source=='0' ? 'checked' :''}
                                        name="play_from_source" title="关闭" />
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">高速推流</label>
                                <div class="layui-input-block">
                                    <input type="radio" value="1" {$data.enable_webrtc=='1' ? 'checked' :''}
                                        name="enable_webrtc" title="开启" />
                                    <input type="radio" value="0" {$data.enable_webrtc=='0' ? 'checked' :''}
                                        name="enable_webrtc" title="关闭" />
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block text-center">
                                    <button class="layui-btn" lay-submit="" lay-filter="edit-info">确认保存</button>
                                    <button class="layui-btn layui-btn-primary" id="close">取消</button>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="/layuiadmin/layui/layui.js"></script>
    <script src="/assets/cos-js-sdk-v5/cos-js-sdk-v5.min.js"></script>
    <script>
        layui.config({
            base: '/layuiadmin/' //静态资源所在路径
            , version: "{:config('other.ui_version')}"
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'admin', 'live'], function () {
            var $ = layui.$
                , form = layui.form
                , admin = layui.admin;
            var index = parent.layer.getFrameIndex(window.name);

            $('#close').on("click", function () {
                parent.layer.close(index);
            });

            form.on('submit(edit-info)', function (obj) {
                //提交
                layer.load();
                admin.req({
                    url: '{:url("live/edit")}'
                    , data: obj.field
                    , success: function (res) {
                        layer.closeAll("loading");
                        if (res.code == 0) {
                            parent.layer.close(index);
                            parent.layer.msg(res.msg, { icon: 1 });
                            //bug fix: 操作人员设置完热度数值点击确定配置窗口没有消失的bug
                            parent.layui.table.reload('LAY-live-manage');
                        }
                    },
                    complete: function () {
                        layer.closeAll("loading");
                    },
                });
            });
        });
    </script>
</body>

</html>